package handlers

import (
	"repo-master/models"

	"github.com/gin-gonic/gin"
)

func CreateRepo(c *gin.Context) {
	repo_name := c.PostForm("repo_name")
	area := c.PostForm("area")
	if repo_name == "" || area == "" {
		c.JSON(200, gin.H{
			"code": 500,
			"msg":  "字段不能为空",
		})
		return
	}
	data := models.Repo{
		RepoName: repo_name,
		Area:     area,
	}
	models.DB.Create(&data)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "添加成功",
	})
	return
}
